<?php
namespace app\common\model;

use think\Model;

class PlayerRole extends Model
{
    protected $connection = 'db_config_aiqi';

    public static function get_list($where,$order,$page = 1)
    {
        $list = self::where($where)
            ->order($order)
            ->paginate(20);
        return $list;
    }

    public static function create_role($data)
    {
        $role_data = self::get_rloe_data($data);
        $result = self::create($role_data);
        return $result;
    }


    public static function get_rloe_data($data){
        return [
            'uid'=>$data['uid'] ?? 0,
            'cid'=>$data['cid'] ?? 0,
            'gid'=>$data['gid'] ?? 0,
            'sid'=>$data['sid'] ?? 0,
            'role_id'=>$data['role_id']??0,
            'role_name'=>$data['role_name'] ?? 0,
            'role_level'=>$data['role_level'] ?? 0,
            'role_power'=>$data['role_power'] ?? 0,
            'create_time' => date('Y-m-d H:i:s'),
        ];
    }
}